//
//  AXHdzqHomeFourthCollectionCell.m
//  AnXin100
//
//  Created by 天质弘耕 on 2018/10/30.
//  Copyright © 2018 tzhg. All rights reserved.
//

#import "AXHdzqHomeFourthCollectionCell.h"
#import "UIView+SDAutoLayout.h"
#import "ZXCategories.h"


@implementation AXHdzqHomeFourthCollectionCell

- (id)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        
        [self creatView];
        [self setlayout];
        
        
    }
    return self;
}

- (void)creatView {
    
    
    
    /** imageview */
    self.storeImageView = [[UIImageView alloc]init];
    self.storeImageView.backgroundColor = [UIColor whiteColor];
    self.storeImageView.image = [UIImage imageNamed:@"j6.jpg"];
    self.storeImageView.contentMode =UIViewContentModeScaleToFill;
    self.storeImageView.clipsToBounds = YES;
    [self.contentView addSubview:self.storeImageView];
    
    /** 名字 */
    self.nameLabel = [[UILabel alloc]init];
    self.nameLabel.backgroundColor = [UIColor whiteColor];
    self.nameLabel.font = FONT_TWELVE;
    self.nameLabel.text = @"新鲜水果";
    self.nameLabel.textColor = COLOR_DIV;
    self.nameLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView  addSubview:self.nameLabel];
    
    /** 价格 */
    self.priceLabel = [[UILabel alloc]init];
    self.priceLabel.backgroundColor = [UIColor whiteColor];
    self.priceLabel.font = FONT_TWELVE;
    self.priceLabel.textAlignment = NSTextAlignmentRight;
    self.priceLabel.text = @"￥9.9";
    self.priceLabel.textColor = COLOR_ORG;
    self.priceLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView  addSubview:self.priceLabel];
    
    
    
}

- (void)setlayout {
    
    
    
    
    float w = (Wi-40)/3;
    /** 店铺图片 */
    self.storeImageView.sd_layout
    .leftSpaceToView(self.contentView,0)
    .topSpaceToView(self.contentView,0)
    .rightSpaceToView(self.contentView, 0)
    .heightIs(w-20);
    
    /** 店铺名字 */
    self.nameLabel.sd_layout
    .leftEqualToView(self.storeImageView)
    .topSpaceToView(self.storeImageView,0)
    .widthRatioToView(self.storeImageView, 1)
    .autoHeightRatio(0)
    .minHeightIs(40);
    
    /** 价格 */
    self.priceLabel.sd_layout
    .leftEqualToView(self.storeImageView)
    .topSpaceToView(self.nameLabel, 0)
    .widthRatioToView(self.storeImageView, 1)
    .heightIs(20);
    
    
    
}

- (void)tapPraise:(UIButton *)btn {
    
}

@end
